//
//  ButtonBadgeViewController.m
//  MyFramework
//
//  Created by 余洋 on 2018/8/10.
//  Copyright © 2018年 余洋. All rights reserved.
//

#import "ButtonBadgeViewController.h"
#import "UIButton+Badge.h"

@interface ButtonBadgeViewController ()

@property (weak, nonatomic) IBOutlet UIButton *button1;
@property (weak, nonatomic) IBOutlet UIButton *button2;
@property (weak, nonatomic) IBOutlet UIButton *button3;
@property (weak, nonatomic) IBOutlet UIButton *button4;
@property (nonatomic, assign) NSInteger badgeNum;

@end

@implementation ButtonBadgeViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createButton];
    self.badgeNum = 0;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)createButton {
    self.button1.badgeValue = @"10";
    self.button1.badgeBGColor = [UIColor redColor];
    
    self.button2.badgeValue = @" ";
    self.button2.badgeBGColor = [UIColor redColor];
    self.button2.badgeFont = [UIFont systemFontOfSize:1.f];
    self.button2.badgeMinSize = 5.f;
    
    self.button3.badgeValue = @"10";
    self.button3.badgeBGColor = [UIColor greenColor];
}

- (IBAction)changeBrageAction:(id)sender {
    self.badgeNum = self.badgeNum + 1;
    self.button4.badgeValue = [NSString stringWithFormat:@"%ld",(long)self.badgeNum];
    self.button4.badgeBGColor = [UIColor redColor];
}
@end
